//
//  WaitBuyderRefCell.m
//  CenturyCity
//
//  Created by beisheng03 on 2018/1/18.
//  Copyright © 2018年 beisheng. All rights reserved.
//

#import "WaitBuyderRefCell.h"

@interface WaitBuyderRefCell ()
@property (weak, nonatomic) IBOutlet UILabel *topLabel;
@property (weak, nonatomic) IBOutlet UILabel *onetTitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *twoTitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *oneSubLabel;
@property (weak, nonatomic) IBOutlet UILabel *twoSubLabel;
@property (weak, nonatomic) IBOutlet UILabel *gongShiLabel;
@property (weak, nonatomic) IBOutlet UILabel *numberLabel;
@property (weak, nonatomic) IBOutlet UITextField *topTextField;
@property (weak, nonatomic) IBOutlet UITextField *bottomTextField;

@end

@implementation WaitBuyderRefCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.contentView.backgroundColor = viewBgGrey;
    self.topLabel.font = [UIFont boldSystemFontOfSize:16];
    
    self.onetTitleLabel.font = [UIFont boldSystemFontOfSize:16];
    
    self.oneSubLabel.font = MYFONT(16);
    
    self.twoTitleLabel.font = [UIFont boldSystemFontOfSize:16];
    
    self.twoSubLabel.font = MYFONT(14);
    
    self.twoSubLabel.textColor = darkGray;
    
    self.gongShiLabel.font = MYFONT(15);
    
    self.numberLabel.font = MYFONT(15);
    self.oneSubLabel.attributedText = [self attributedString:@"请退货,未经卖家同意请不要使用到付或平邮.退货地址:该商家暂未配置收货地址" withFont:MYFONT(16)];
    
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(textChange) name:UITextFieldTextDidChangeNotification object:self.topTextField];

    
       [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(textChange1) name:UITextFieldTextDidChangeNotification object:self.bottomTextField];
    // Initialization code
}


- (NSAttributedString *)attributedString:(NSString *)str withFont:(UIFont *)font{
    
    NSMutableAttributedString *attr = [[NSMutableAttributedString alloc]initWithString:str];
    
    [attr addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, str.length)];
    [attr addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0, str.length)];
    [attr addAttribute:NSKernAttributeName value:@(1.0f) range:NSMakeRange(0, str.length)];
    
    NSMutableParagraphStyle *para = [[NSMutableParagraphStyle alloc]init];
    
    para.lineSpacing = 1;
    
    para.firstLineHeadIndent = 20;
    
    [attr addAttribute:NSParagraphStyleAttributeName value:para range:NSMakeRange(0, str.length)];
    
    
    return attr;
}


- (void)textChange{
    
    
    
    self.model.refund_shipping_company = self.topTextField.text;
    
    
    
}




- (void)textChange1{
    
    
    self.model.refund_shipping_code = self.bottomTextField.text;

    
    
    
}

- (void)setModel:(ApplyRefundParmModel *)model{
    _model = model;
    
    if (_model.refund_shipping_company.length > 0) {
        
        self.topTextField.text = _model.refund_shipping_company;
    }
    
    
    if (_model.refund_shipping_code.length > 0) {
        
        self.bottomTextField.text = _model.refund_shipping_code;
    }
    
    
    
    
}











- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
